const { DataTypes } = require('sequelize');
const sq = require('./db.js')
const moment = require('moment')
const Pos = sq.define('pos', {
    articleid:{
        type: DataTypes.INTEGER,
        comment: "文章id",
        unique:true
    },
    pos_name: {
        type: DataTypes.STRING,
        allowNull: false,
        require:true,
        comment: "地点",
        unique:true
    },
    createdAt: {
        type: DataTypes.DATE,
        get() {
            return moment(this.getDataValue("createdAt")).format("YYYY-MM-DD HH:mm:ss")
        },
    },
    updatedAt: {
        type: DataTypes.DATE,
        get() {
            return moment(this.getDataValue("updatedAt")).format("YYYY-MM-DD HH:mm:ss")
        },
    },
}, {
    // 这是其他模型参数
    freezeTableName: true,
});/* 
Pos.sync({ force: true }) */
module.exports = Pos;